//
//  APWorksDetailCommentCell.m
//  AqualPolo
//
//  Created by dong on 2024/5/10.
//

#import "APWorksDetailCommentCell.h"

@implementation APWorksDetailCommentCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = UIColor.clearColor;
        self.backgroundColor = UIColor.clearColor;
        _containerView = [[UIView alloc] init];
        _containerView.backgroundColor = LYRGBColor(18, 23, 78);
        _containerView.layer.cornerRadius = 8;
        _containerView.layer.masksToBounds = true;
        [self.contentView addSubview:_containerView];
        [_containerView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView);
            make.left.equalTo(self.contentView).offset(20);
            make.right.equalTo(self.contentView).offset(-20);
            make.bottom.equalTo(self.contentView);
        }];
        


        _avatarImageView = [[UIImageView alloc] init];
        _avatarImageView.layer.cornerRadius = 14;
        _avatarImageView.layer.masksToBounds = true;
        [_containerView addSubview:_avatarImageView];
        [_avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.equalTo(_containerView).offset(8);
            make.size.mas_equalTo(28);
        }];
        
        _upvoteButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_upvoteButton setImage:[UIImage imageNamed:@"upvote_blue_rect_n"] forState:UIControlStateNormal];
        [_upvoteButton setImage:[UIImage imageNamed:@"upvote_blue_rect_h"] forState:UIControlStateSelected];
        [_containerView addSubview:_upvoteButton];
        [_upvoteButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(_containerView);
            make.centerY.equalTo(_avatarImageView.mas_centerY);
            make.size.mas_equalTo(CGSizeMake(52, 52));
        }];
        
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.textColor = [UIColor whiteColor];
        _nameLabel.font = [LYFont fontWithSize:14 fontName:LYFontNamepfm];
        _nameLabel.textAlignment = NSTextAlignmentLeft;
        [_containerView addSubview:_nameLabel];
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_avatarImageView.mas_right).offset(8);
            make.centerY.equalTo(_avatarImageView);
            make.right.equalTo(_upvoteButton.mas_left).offset(-8);
        }];
        
        
        
    }
    return self;
}

@end
